import request from '@/utils/request'

// 获取首页信息
export function getIndexApi() {
  return request({
    method: 'get',
    url: '/index/page'
  })
}
// 最美网文
export function getnetworkApi({
  cid,
  sort,
  keyword,
  page,
  page_size}: {  
  cid: number; // 或其他类型，根据你的需求定义  
  sort: string; // 同上  
  keyword: string; // 同上  
  page: number; // 同上  
  page_size: number; // 同上  
}) { 
  return request({
    method: 'get',
    url: `/index/network?cid=${cid}&sort=${sort}&keyword=${keyword}&page=${page}&page_size=${page_size}`
  })
}
export function getnetworkApi3({
  cid,
  keyword,
  page,
  page_size}: {  
  cid: number; // 或其他类型，根据你的需求定义  
  sort: string; // 同上  
  keyword: string; // 同上  
  page: number; // 同上  
  page_size: number; // 同上  
}) { 
  return request({
    method: 'get',
    url: `/index/network?cid=${cid}&keyword=${keyword}&page=${page}&page_size=${page_size}`
  })
}
export function getnetworkApi1() {
   return request({
    method: 'get',
    url: '/index/network_cate'
  })
}
export function getnetworkApi2(id:any) {
   return request({
    method: 'get',
    url: `/index/network_detail?id=${id}`
  })
}
// 学习矩阵
export function getmatrixApi({
  cid,
  keyword,
  page,
  page_size}:{  
  cid: any; // 或其他类型，根据你的需求定义  
  keyword: any; // 同上  
  page:any; // 同上  
  page_size: any; // 同上  
}) { 
  return request({
    method: 'get',
    url: `/index/matrix?cid=${cid}&keyword=${keyword}&page=${page}&page_size=${page_size}`
  })
}
export function getmatrixApi1() {
   return request({
    method: 'get',
    url: '/index/matrix_cate'
  })
}
export function getmatrixApi2(id:any) {
   return request({
    method: 'get',
    url: `/index/matrix_detail?id=${id}`
  })
}
// 计时得积分
export function getpointApi(data:any) {
   return request({
    method: 'post',
    url: '/index/point_add',
    data
  })
}
// 评论
export function getsourceApi({ source, id, self }: {
  source: any;
  id: any;
  self: any;
}) { 
  return request({
    method: 'get',
    url: `/index/comment?source=${source}&id=${id}&self=${self}`
  })
}
// 我的评论
export function getsource1Api({ page, page_size, self }: {
  page: any;
  page_size: any;
  self: any;
}) { 
  return request({
    method: 'get',
    url: `/index/comment?page=${page}&page_size=${page_size}&self=${self}`
  })
}
export function getcommentApi(data:any) {
   return request({
    method: 'post',
    url: '/index/comment_add',
    data
  })
}
export function getcommentdelApi(data:any) {
   return request({
    method: 'post',
    url: '/index/comment_del',
    data
  })
}
// 视频
export function getvideocateApi() {
   return request({
    method: 'get',
    url: '/index/video_cate'
  })
}
export function getvideoApi({cid,page,page_size}:{cid:any,page:any,page_size:any}) {
   return request({
    method: 'get',
    url: `/index/video?cid=${cid}&page=${page}&page_size=${page_size}`,
  })
}
export function getviewsApi(data:any) {
   return request({
    method: 'post',
    url: '/index/video_views',
    data
  })
}
// 理论之星
export function gettheoryApi(calendar:any) {
   return request({
    method: 'get',
    url: `/index/theory?calendar=${calendar}`
  })
}
export function gettheoryApi1() {
   return request({
    method: 'get',
    url: '/index/theory'
  })
}
// 答题
export function getanswerApi() {
   return request({
    method: 'get',
    url: '/index/answer?page=1&page_size=10'
  })
}
// 个人
export function deptInfo() {
    return request({
        method: 'get',
        url: '/user/member_info?member_id=0'
    })
}
export function deptPoint() {
    return request({
        method: 'get',
        url: '/user/member_point?member_id=0'
    })
}
// 留言
export function gitmessageApi({ page, page_size, self }: {
  page: any;
  page_size: any;
  self: any;
}) {
    return request({
        method: 'get',
        url: `/index/message?page=${page}&page_size=${page_size}&self=${self}`
    })
}
export function getmessagedelApi(data:any) {
    return request({
      method: 'post',
      url: '/index/message_del',
      data
    })
}
// 修改密码
export function getchangePasswordApi(data:any) {
    return request({
      method: 'post',
      url: '/user/changePassword',
      data
    })
}
// 空间动态
export function getlistsApi({page, page_size}:{page:any, page_size:any}) {
    return request({
      method: 'get',
      url: `/style/lists?page=${page}&page_size=${page_size}`
    })
}
export function getlikeApi(data:any) {
    return request({
      method: 'post',
      url: '/style/like',
      data
    })
}
export function getaddApi(data:any) {
    return request({
      method: 'post',
      url: '/style/add',
      data
    })
}
// 动态审核
export function getreviewApi({start_time, end_time,keyword,status,page,page_size}:{start_time:any, end_time:any,keyword:any,status:any,page:any,page_size:any}) {
    return request({
      method: 'get',
      url: `/style/review?start_time=${start_time}&end_time=${end_time}&keyword=${keyword}&status=${status}&page=${page}&page_size=${page_size}`
    })
}
export function gereviewdoApi(data:any) {
    return request({
      method: 'post',
      url: '/style/review_do',
      data
    })
}
export function gerlistsApi(id:any) {
    return request({
      method: 'get',
      url: `/style/lists?id=${id}`
    })
}
export function gerdelApi(data:any) {
    return request({
      method: 'post',
      url: '/style/del',
      data
    })
}
export function germembereditApi(data:any) {
    return request({
      method: 'post',
      url: '/user/member_edit',
      data
    })
}
// 上传
enum API {
  //上传图片接口
  UPLOAD_URL = '/upload/image'
}
// 对外导出上传图片的接口
export const reqUpload = (file:any) => {
  // 创建了一个新的 FormData 对象，用于构建表单数据,并将file添加到FormData对象中
  const formData = new FormData();
  formData.append('file', file);
 
  return request.post(API.UPLOAD_URL, formData);
}
// 公开栏
export function getreleaseApi({
  cid,
  keyword,
  page,
  page_size}: {  
  cid: number; // 或其他类型，根据你的需求定义  
  sort: string; // 同上  
  keyword: string; // 同上  
  page: number; // 同上  
  page_size: number; // 同上  
}) { 
  return request({
    method: 'get',
    url: `/index/release?cid=${cid}&keyword=${keyword}&page=${page}&page_size=${page_size}`
  })
}
// 工作台弹框
export function getmarkApi(data:any) {
    return request({
      method: 'post',
      url: '/matter/mark',
      data
    })
}
export function getmark1Api(id:any) {
    return request({
      method: 'get',
      url: `/matter/detail?todo_id=${id}`,
    })
}
export function getdeptApi(id:any) {
    return request({
      method: 'get',
      url: `/matter/dept?todo_id=${id}`,
    })
}